package com.gfxy.modules.items.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gfxy.modules.excel.ExcelUtil;
import com.gfxy.modules.items.entity.Qtxmjxkh;
import com.gfxy.modules.items.mapper.QtxmjxkhMapper;
import com.gfxy.modules.items.service.IQtxmjxkhService;
import com.gfxy.modules.items.vo.QtxmjxkhMemberPage;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 其他项目-核心指标
 * @Author: jeecg-boot
 * @Date:   2024-01-04
 * @Version: V1.0
 */
@Service
public class QtxmjxkhServiceImpl extends AbstractProjectServiceImpl<QtxmjxkhMapper, Qtxmjxkh> implements IQtxmjxkhService {

	public QtxmjxkhServiceImpl() {
		this.memberCellNum = 3;
	}
	@Override
	public Double getTotalScore(Qtxmjxkh qtxmjxkh) {
		return 0.0;
	}

	@Override
	public IPage<QtxmjxkhMemberPage> selectListPage(String date, Integer pageNo, Integer pageSize) {
		Page<QtxmjxkhMemberPage> page = new Page<>(pageNo, pageSize);

		Page<QtxmjxkhMemberPage> page1 = page.setRecords(baseMapper.selectMemberPageListByYear(date));

		return page1;
	}

	@Override
	public List<QtxmjxkhMemberPage> getMemberPageListByYear(String date) {
		return baseMapper.selectMemberPageListByYear(date);
	}

	@Override
	protected Qtxmjxkh getOneProject(Row row) {
		String date =  ExcelUtil.formatCell(row.getCell(0));
		String name =  ExcelUtil.formatCell(row.getCell(1));
		String score = ExcelUtil.formatCell(row.getCell(2));

		Qtxmjxkh qtxmjxkh = new Qtxmjxkh();
		qtxmjxkh.setDate(date);
		qtxmjxkh.setProjectName(name);
		qtxmjxkh.setTotalScore(Double.valueOf(score));


		return qtxmjxkh;
	}


}
